import { Greet, StartChatlog, StopChatlog } from "@native";
import { useState } from "react";
import { useNavigate } from "react-router";

export default function DemoView(props: {}) {
  const [resultText, setResultText] = useState("Please enter your name below 👇");
  const [name, setName] = useState('');
  const updateName = (e: any) => setName(e.target.value);
  const updateResultText = (result: string) => setResultText(result);
  const [text, setText] = useState('');
  const nav = useNavigate()
  return <>
    <div id="result" className="result">{resultText}</div>
    <div id="result" className="result">{text}</div>
    <div id="input" className="input-box">
      <input id="name" className="input" onChange={updateName} autoComplete="off" name="input" type="text" />
      <button className="btn" onClick={() => Greet(name).then(updateResultText)}>Greet</button>
      <button className="btn" onClick={() => nav('about')}>About</button>
    </div>
  </>
}